/*
 * @Description: js中数学对象的方法(Math)
 * @Author: zzj
 * @Date: 2021-09-09 09:49:12
 * @LastEditors: zzj
 * @LastEditTime: 2021-09-09 10:06:43
 */

//Math  数学内置对象
var arr = [1,5,63,2,8,9,4,2,9];
console.log(Math.max(...arr));  //...arr将数组进行拆解，一个一个的输入
console.log(Math.min(1,5,63,2,8,9,4,2,9));
var num = 12.4;
console.log(Math.ceil(num));  //向上取舍  +1
console.log(Math.floor(num));  //向下取舍  -1
console.log(Math.round(num));  //四舍五入
console.log(parseInt(num));  //向下 舍弃
//随机数
console.log(Math.random());//获取一个0-1的随机数
console.log(Math.ceil(Math.random()*100));//1-100
console.log(Math.ceil(Math.random()*100)-50);//-50~50
console.log(Math.PI);//圆周率